home *** CD-ROM | disk | FTP | other *** search
- Path: ldb.han.de!W.FANDRYCH
- From: W.FANDRYCH@LDB.han.de (Wolfgang H. A. Fandrych)
- Newsgroups: comp.lang.c
- Subject: Re: What's so different about 2-D arrays???
- Date: 3 Jan 96 12:42:00 +0100
- Message-ID: <60BE2pvlvlB@ldb-wf.ldb.HAN.DE>
- References: <820451938.20697@fredblog.demon.co.uk>
- X-Mailer: CrossPoint v3.02
- X-Gateway: ZCONNECT UH ldb.han.de [UUCPfZ V5.69 U002]
-
- Hi to all and hi to mark@fredblog.demon.co.uk!
-
- On 31.12.95, you wrote about
- "What's so different about 2-D arrays???":
-
- > //My own chess recorder program
- >
- > void setup(char pos[8][8])
- > {
- > int x,y;
- >
- > pos[1][8]=pos[8][8]='r';
- > [...]
- >
- > I have written a similar program since, as a test, which uses a 1-D
- > array with no problems. Can someone help me with this problem.
- There's no difference between 1d and 2d arrays except you were very lucky
- when you wrote your other version. If you create an array like
- char foo[8];
- you've got 8 characters in your array and legal indices range from 0 to 7!
- The same is true for your pos[8][8]: your index should be between
- pos[0][0] and pos[7][7].
-
- Bye
- Alwin.
- --
- If you've got an idea Wolfgang Hermann Alwin PGP-Key
- for a nice signature Fandrych available on
- send email to: W.Fandrych@LDB.HAN.DE request
-
-